﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Microsoft.Synchronization.Data;
using System.Data;
using System.Collections.ObjectModel;
using System.ServiceModel.Activation;
using Microsoft.Practices.Unity;

namespace Infrastructure.WpfClient.Accessibility
{
    [ServiceContractAttribute()]
    public interface IAccessibilityDataCacheSyncService
    {
        [OperationContract()]
        SyncContext ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession);

        [OperationContract()]
        SyncContext GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession);

        [OperationContract()]
        SyncSchema GetSchema(Collection<string> tableNames, SyncSession syncSession);

        [OperationContract()]
        SyncServerInfo GetServerInfo(SyncSession syncSession);
    }
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class AccessibilityDataCacheSyncService : IAccessibilityDataCacheSyncService
    {
        [Dependency]
        public AccessibilityCacheServerSyncProvider _serverSyncProvider { get; set; }

        public AccessibilityDataCacheSyncService()
        {
            
        }

        public virtual SyncContext ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession)
        {
            return this._serverSyncProvider.ApplyChanges(groupMetadata, dataSet, syncSession);
        }

        public virtual SyncContext GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
        {
            return this._serverSyncProvider.GetChanges(groupMetadata, syncSession);
        }

        public virtual SyncSchema GetSchema(Collection<string> tableNames, SyncSession syncSession)
        {
            return this._serverSyncProvider.GetSchema(tableNames, syncSession);
        }

        public virtual SyncServerInfo GetServerInfo(SyncSession syncSession)
        {
            return this._serverSyncProvider.GetServerInfo(syncSession);
        }
    }
}
